package cn.com.huak.www.sell.utils;

import cn.com.huak.www.sell.vo.ResultVo;

/**
 * 返回实体工具类
 * @author huak@wanggang
 * @date 2018/12/30 19:17
 */
public class ResultVoUtil {

    /* 带有数据的返回实体 */
    public static ResultVo success(Object data){
        ResultVo<Object> resultVo = new ResultVo<>();
        resultVo.setCode(0);
        resultVo.setMessage("成功");
        resultVo.setData(data);
        return resultVo;
    }

    /* 无数据的返回实体 */
    public static ResultVo success(){
        ResultVo<Object> resultVo = new ResultVo<>();
        resultVo.setCode(0);
        resultVo.setMessage("成功");
        resultVo.setData(null);
        return resultVo;
    }

    /* 失败方法 */
    public static ResultVo error(String message){
        ResultVo<Object> resultVo = new ResultVo<>();
        resultVo.setCode(1);
        resultVo.setMessage(message);
        resultVo.setData(null);
        return resultVo;
    }
}
